home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-1.iso / math / ast51src.zip / ASTROLOG.H < prev    next >
C/C++ Source or Header  |  1995-12-31  |  49KB  |  1,366 lines

  1. /*
  2. ** Astrolog (Version 5.10) File: astrolog.h
  3. **
  4. ** IMPORTANT NOTICE: The graphics database and chart display routines
  5. ** used in this program are Copyright (C) 1991-1995 by Walter D. Pullen
  6. ** (Astara@msn.com). Permission is granted to freely use and
  7. ** distribute these routines provided one doesn't sell, restrict, or
  8. ** profit from them in any way. Modification is allowed provided these
  9. ** notices remain with any altered or edited versions of the program.
  10. **
  11. ** The main planetary calculation routines used in this program have
  12. ** been Copyrighted and the core of this program is basically a
  13. ** conversion to C of the routines created by James Neely as listed in
  14. ** Michael Erlewine's 'Manual of Computer Programming for Astrologers',
  15. ** available from Matrix Software. The copyright gives us permission to
  16. ** use the routines for personal use but not to sell them or profit from
  17. ** them in any way.
  18. **
  19. ** The PostScript code within the core graphics routines are programmed
  20. ** and Copyright (C) 1992-1993 by Brian D. Willoughby
  21. ** (brianw@sounds.wa.com). Conditions are identical to those above.
  22. **
  23. ** The extended accurate ephemeris databases and formulas are from the
  24. ** calculation routines in the program "Placalc" and are programmed and
  25. ** Copyright (C) 1989,1991,1993 by Astrodienst AG and Alois Treindl
  26. ** (alois@azur.ch). The use of that source code is subject to
  27. ** regulations made by Astrodienst Zurich, and the code is not in the
  28. ** public domain. This copyright notice must not be changed or removed
  29. ** by any user of this program.
  30. **
  31. ** Initial programming 8/28,30, 9/10,13,16,20,23, 10/3,6,7, 11/7,10,21/1991.
  32. ** X Window graphics initially programmed 10/23-29/1991.
  33. ** PostScript graphics initially programmed 11/29-30/1992.
  34. ** Last code change made 12/27/1995.
  35. */
  36.  
  37. /*
  38. ** TO COMPILE: For most systems, especially Unix, DOS, and Macs, the only
  39. ** changes that should need to be made to the code are to edit or comment the
  40. ** #define's below to equal the particulars of your own system and locale:
  41. **
  42. ** SYSTEM SECTION: These settings describe platform and hardware specifics.
  43. ** They are all required to be set properly or the program likely won't
  44. ** compile or run. Some of these are technically optional and can be
  45. ** commented out even if your system would normally support them, e.g.
  46. ** the X11 graphics can be disabled even if you are running X windows.
  47. */
  48.  
  49. #define PC /* Comment out this #define if you have a Unix, Mac, or other */
  50.            /* system that isn't a generic PC running DOS or MS Windows.  */
  51.  
  52. /*#define MAC /* Comment out this #define if you're not compiling for a Mac. */
  53.  
  54. /*#define X11 /* Comment out this #define if you don't have X windows, or */
  55.             /* else have them and don't wish to compile in X graphics.  */
  56.  
  57. /*#define WIN /* Comment out this #define if you don't have MS Windows, or */
  58.             /* else have them but want to compile a DOS version instead. */
  59.  
  60. #define MSG /* Comment out this #define if you don't have access to the     */
  61.             /* Microsoft C PC graphics library as in graph.h, or you do and */
  62.             /* have a PC and just don't wish to compile these graphics in.  */
  63.  
  64. /*#define BGI /* Comment out this #define if you don't have access to the  */
  65.             /* Borland C BGI graphics library for PC's in graphics.h, or */
  66.             /* you do and just don't wish to compile such graphics in.   */
  67.  
  68. #define MOUSE /* Comment out this #define if you don't have a mouse, or    */
  69.               /* don't wish to compile in mouse tracking features. This    */
  70.               /* is only an option if X11, WIN, MSG, or BGI above are set. */
  71.  
  72. #define TIME /* Comment out this #define if your compiler can't take the  */
  73.              /* calls to the 'time' or 'localtime' functions as in time.h */
  74.  
  75. #define SWITCHES /* Comment out this #define if your system can not handle */
  76.                  /* parameters on the command line (such as Mac's).        */
  77.  
  78. #define ENVIRON /* Comment out this #define if your system doesn't have  */
  79.                 /* environment variables or can't compile calls to them. */
  80.  
  81. /*#define ATOF /* Comment out this #define if you have a system in which  */
  82.              /* 'atof' and related functions aren't defined in stdio.h, */
  83.              /* such as most PC's, Linux, VMS compilers, and NeXT's.    */
  84.  
  85. #define PROTO /* Comment out this #define if you have an older compiler   */
  86.               /* which doesn't allow full Ansi function prototypes. This  */
  87.               /* is for programmers only and has no effect on executable. */
  88.  
  89. /*
  90. ** FEATURES SECTION: These settings describe features that are always
  91. ** available to be compiled into the program no matter what platform or
  92. ** hardware is available. Their settings are always optional.
  93. */
  94.  
  95. #define GRAPH /* Comment out this #define if you don't want any graphics   */
  96.               /* in the program. This switch allows at least generation of */
  97.               /* bitmap files and must be set if any of the more advanced  */
  98.               /* graphics feature additions are also compiled in.          */
  99.  
  100. #define PLACALC /* Comment out this #define if you don't want the more */
  101.                 /* accurate calculation features and formulas to be    */
  102.                 /* compiled into the program (as accessed with -b).    */
  103.  
  104. #define PS /* Comment out this #define if you don't want the ability to */
  105.            /* generate charts in the PostScript graphics format.        */
  106.  
  107. #define META /* Comment out this #define if you don't want the ability to  */
  108.              /* generate charts in the MS Windows metafile picture format. */
  109.  
  110. #define INTERPRET /* Comment out this #define if you don't want the ability */
  111.                   /* to display interpretations of the various chart types. */
  112.  
  113. #define ARABIC /* Comment out this #define if you don't want any chart     */
  114.                /* lists that include Arabic parts included in the program. */
  115.  
  116. #define CONSTEL /* Comment out this #define if you don't want any of the */
  117.                 /* astronomical constellation charts in the program.     */
  118.  
  119. #define BIORHYTHM /* Comment out this #define if you don't want the    */
  120.                   /* non-astrological biorhythm charts in the program. */
  121.  
  122. /*
  123. ** DATA CONFIGURATION SECTION: These settings describe particulars of
  124. ** your own location and where the program looks for certain info. It is
  125. ** recommended that these values be changed appropriately, although the
  126. ** program will still run if they are left alone.
  127. */
  128.  
  129. #ifndef PC
  130. #define DEFAULT_DIR "~/astrolog"
  131. #else
  132. #define DEFAULT_DIR "C:\\ASTROLOG"
  133. #endif
  134.   /* Change this string to directory path program should look in for the  */
  135.   /* astrolog.dat default file, if one is not in the current directory or */
  136.   /* in the dirs indicated by environment variables. For PC systems, use  */
  137.   /* two backslashes instead of one forward one to divide subdirectories. */
  138.  
  139. #define CHART_DIR DEFAULT_DIR
  140.   /* This string is the directory the program looks in for chart info    */
  141.   /* files (-i switch) if not in the current directory. This is normally */
  142.   /* the default dir above but may be changed to be somewhere else.      */
  143.  
  144. #define EPHE_DIR DEFAULT_DIR
  145.   /* This string is the directory the program looks in for the ephemeris */
  146.   /* files as accessed with the -b switch. This is normally the default  */
  147.   /* dir above but may be changed to be somewhere else.                  */
  148.  
  149. #define DEFAULT_LONG 122.20 /* Change these values to the longitude west    */
  150. #define DEFAULT_LAT   47.36 /* and latitude north of your current location. */
  151.                             /* Use negative values for east/southern areas. */
  152.  
  153. #define DEFAULT_ZONE 8.00 /* Change this number to the time zone of your */
  154.                           /* current location in hours before (west of)  */
  155.                           /* GMT. Use negative values for eastern zones. */
  156.  
  157. /*
  158. ** OPTIONAL CONFIGURATION SECTION: Although not necessary, one may like
  159. ** to change some of the values below: These constants affect some of
  160. ** the default parameters and other such things.
  161. */
  162.  
  163. #define DEFAULT_SYSTEM 0 /* Normally, Placidus houses are used (unless the */
  164.                          /* user specifies otherwise). If you want a       */
  165.                          /* different default system, change this number   */
  166.                          /* to a value from 0..9 (values same as in -c).   */
  167.  
  168. #define DEFAULT_ASPECTS 5 /* Default number of aspects to use in charts. */
  169.  
  170. #define DIVISIONS 12 /* Greater numbers means more accuracy but slower  */
  171.                      /* calculation, of exact aspect and transit times. */
  172.  
  173. #define DEFAULT_INFOFILE "astrolog.dat"
  174.   /* Name of file to look in for default program parameters (which will */
  175.   /* override the compile time values here, if the file exists).        */
  176.  
  177. #define ENVIRONALL "ASTROLOG"
  178. #define ENVIRONVER "ASTR"
  179.   /* Name of environment variables to look in for chart, ephemeris, and  */
  180.   /* default files. The second name is a version specific variable which */
  181.   /* gets the current version appended to it before it is accessed.      */
  182.  
  183. #define WHEELCOLS 15   /* Affects width of each house in wheel display.    */
  184. #define WHEELROWS 11   /* Max no. of objects that can be in a wheel house. */
  185. #define SCREENWIDTH 80 /* Number of columns to print interpretations in.   */
  186. #define MONTHSPACE 3   /* Number of spaces between each calendar column.   */
  187. #define MAXINDAY 150   /* Max number of aspects or transits displayable.   */
  188. #define MAXCROSS 750   /* Max number of latitude crossings displayable.    */
  189. #define CREDITWIDTH 74 /* Number of text columns in the -Hc credit screen. */
  190. #define MAXSWITCHES 32 /* Max number of switch parameters per input line.  */
  191. #define PSGUTTER 9     /* Points of white space on PostScript page edge.   */
  192.  
  193.  
  194. #ifdef GRAPH           /* For graphics, this char affects how bitmaps are */
  195. #ifndef PC             /* written. 'N' is written like with the 'bitmap'  */
  196. #define BITMAPMODE 'C' /* program, 'C' is compacted somewhat (files have  */
  197. #else                  /* less spaces), and 'V' is compacted even more.   */
  198. #define BITMAPMODE 'B' /* 'A' means write as rectangular Ascii text file. */
  199. #endif                 /* 'B' means write as Windows bitmap (.bmp) file.  */
  200.  
  201. #ifdef MSG
  202. #define DEFHIRESMODE _MAXRESMODE /* 'High-resolution' PC graphics mode. */
  203. #define DEFLORESMODE _ERESCOLOR  /* 'Flicker-free' PC graphics mode.    */
  204. #endif
  205. #ifdef BGI
  206. #define DEFHIRESMODE 0 /* Zero or less means a 'hi-res' mode of driver. */
  207. #define DEFLORESMODE 1 /* One or more means a 'lo-res' mode of driver.  */
  208. #endif
  209. #endif /* GRAPH */
  210.  
  211. /*#define TRUENODE /* Comment out this #define if you'd prefer the 'Node'    */
  212.                  /* object to refer to the Mean North Node of the Moon by  */
  213.                  /* default as opposed to the True North Node of the Moon. */
  214.  
  215. /*
  216. ** By the time you reach here and the above values are customized as
  217. ** desired, Astrolog is ready to be compiled! Be sure to similarly
  218. ** change the values in the astrolog.dat file, which will override any
  219. ** corresponding compile time values here. Don't change any of the
  220. ** values in the section below unless you know what you're doing.
  221. */
  222.  
  223. #ifdef GRAPH
  224. #define BITMAPX    2730 /* Maximum window size allowed */
  225. #define BITMAPY    2730
  226. #define BITMAPX1    180 /* Minimum window size allowed */
  227. #define BITMAPY1    180
  228. #define DEFAULTX    480 /* Default window size */
  229. #define DEFAULTY    480
  230. #define SIDESIZE    160 /* Size of wheel chart information sidebar.    */
  231. #define MAXMETA 200000L /* Max bytes allowed in a metafile.            */
  232. #define METAMUL      12 /* Metafile coordinate to chart pixel ratio.   */
  233. #define PSMUL        11 /* PostScript coordinate to chart pixel ratio. */
  234. #define CELLSIZE     14 /* Size for each cell in the aspect grid.      */
  235. #define BIODAYS      14 /* Days to include in graphic biorhythms.      */
  236. #define DEGINC        2 /* Number of degrees per segment for circles.  */
  237. #define DEFORB      7.0 /* Min distance glyphs can be from each other. */
  238. #define MAXSCALE    400 /* Max scale factor as passed to -Xs swtich.   */
  239. #define TILTSTEP  11.25 /* Degrees to change when pressing '[' or ']'. */
  240. #endif /* GRAPH */
  241.  
  242. #define chH    (char)(us.fAnsi ? 196 : '-')  /* Ansi and Ascii characters  */
  243. #define chV    (char)(us.fAnsi ? 179 : '|')  /* used to print text charts. */
  244. #define chC    (char)(us.fAnsi ? 197 : '|')
  245. #define chNW   (char)(us.fAnsi ? 218 : '+')
  246. #define chNE   (char)(us.fAnsi ? 191 : '+')
  247. #define chSW   (char)(us.fAnsi ? 192 : '+')
  248. #define chSE   (char)(us.fAnsi ? 217 : '+')
  249. #define chJN   (char)(us.fAnsi ? 193 : '-')
  250. #define chJS   (char)(us.fAnsi ? 194 : '-')
  251. #define chJW   (char)(us.fAnsi ? 180 : '|')
  252. #define chJE   (char)(us.fAnsi ? 195 : '|')
  253. #define chDeg0 (char)(us.fAnsi ? 248 : ' ')
  254. #define chDeg1 (char)(us.fAnsi ? 248 : ':')
  255.  
  256.  
  257. /*
  258. ** One shouldn't ever need to change anything below this line to compile.
  259. */
  260.  
  261. #define ASTROLOG
  262. #define MATRIX
  263. #include <stdio.h>
  264. #ifndef ATOF
  265. #include <stdlib.h>
  266. #endif
  267. #include <math.h>
  268. #ifdef PC
  269. #include <malloc.h>
  270. #endif
  271. #ifdef TIME
  272. #include <time.h>
  273. #endif
  274.  
  275. #ifdef X11
  276. #define ISG
  277. #include <X11/Xlib.h>
  278. #include <X11/Xutil.h>
  279. #endif
  280. #ifdef WIN
  281. #define ISG
  282. #include "windows.h"
  283. #include "commdlg.h"
  284. #include "print.h"
  285. #include "resource.h"
  286. #endif
  287. #ifdef MSG
  288. #define ISG
  289. #define PCG
  290. #include <graph.h>
  291. #include <conio.h>
  292. #endif
  293. #ifdef BGI
  294. #define ISG
  295. #define PCG
  296. #include <graphics.h>
  297. #include <conio.h>
  298. #endif
  299.  
  300. #ifdef PS
  301. #define STROKE
  302. #endif
  303. #ifdef META
  304. #define STROKE
  305. #endif
  306. #ifdef MOUSE
  307. #ifdef PC
  308. #include <dos.h>
  309. #endif
  310. #endif /* MOUSE */
  311.  
  312.  
  313. /*
  314. ** Make sure only legal combinations of the graphics options are active.
  315. */
  316.  
  317. #ifdef MAC
  318. #ifdef ISG
  319. "If 'MAC' is defined 'X11', 'WIN', 'MSG', or 'BGI' must not be as well"
  320. #endif
  321. #ifdef SWITCHES
  322. "If 'MAC' is defined 'SWITCHES' must not be as well"
  323. #endif
  324. #ifdef ENVIRON
  325. "If 'MAC' is defined 'ENVIRON' must not be as well"
  326. #endif
  327. #endif /* MAC */
  328.  
  329. #ifdef X11
  330. #ifndef GRAPH
  331. "If 'X11' is defined 'GRAPH' must be too"
  332. #endif
  333. #ifdef WIN
  334. "If 'X11' is defined 'WIN' must not be as well"
  335. #endif
  336. #ifdef MSG
  337. "If 'X11' is defined 'MSG' must not be as well"
  338. #endif
  339. #ifdef BGI
  340. "If 'X11' is defined 'BGI' must not be as well"
  341. #endif
  342. #ifdef PC
  343. "If 'X11' is defined 'PC' must not be as well"
  344. #endif
  345. #endif /* X11 */
  346.  
  347. #ifdef WIN
  348. #ifndef GRAPH
  349. "If 'WIN' is defined 'GRAPH' must be too"
  350. #endif
  351. #ifdef X11
  352. "If 'WIN' is defined 'X11' must not be as well"
  353. #endif
  354. #ifdef MSG
  355. "If 'WIN' is defined 'MSG' must not be as well"
  356. #endif
  357. #ifdef BGI
  358. "If 'WIN' is defined 'BGI' must not be as well"
  359. #endif
  360. #ifndef PC
  361. "If 'WIN' is defined 'PC' must be too"
  362. #endif
  363. #endif /* WIN */
  364.  
  365. #ifdef MSG
  366. #ifndef GRAPH
  367. "If 'MSG' is defined 'GRAPH' must be too"
  368. #endif
  369. #ifdef X11
  370. "If 'MSG' is defined 'X11' must not be as well"
  371. #endif
  372. #ifdef WIN
  373. "If 'MSG' is defined 'WIN' must not be as well"
  374. #endif
  375. #ifdef BGI
  376. "If 'MSG' is defined 'BGI' must not be as well"
  377. #endif
  378. #ifndef PC
  379. "If 'MSG' is defined 'PC' must be too"
  380. #endif
  381. #endif /* MSG */
  382.  
  383. #ifdef BGI
  384. #ifndef GRAPH
  385. "If 'BGI' is defined 'GRAPH' must be too"
  386. #endif
  387. #ifdef X11
  388. "If 'BGI' is defined 'X11' must not be as well"
  389. #endif
  390. #ifdef WIN
  391. "If 'BGI' is defined 'WIN' must not be as well"
  392. #endif
  393. #ifdef MSG
  394. "If 'BGI' is defined 'MSG' must not be as well"
  395. #endif
  396. #ifndef PC
  397. "If 'BGI' is defined 'PC' must be too"
  398. #endif
  399. #endif /* BGI */
  400.  
  401. #ifdef MOUSE
  402. #ifdef GRAPH
  403. #ifndef ISG
  404. "If 'MOUSE' is defined 'X11', 'WIN', 'MSG', or 'BGI' must be too"
  405. #endif
  406. #endif /* GRAPH */
  407. #endif /* MOUSE */
  408.  
  409. #ifdef PS
  410. #ifndef GRAPH
  411. "If 'PS' is defined 'GRAPH' must be too"
  412. #endif
  413. #endif /* PS */
  414.  
  415. #ifdef META
  416. #ifndef GRAPH
  417. "If 'META' is defined 'GRAPH' must be too"
  418. #endif
  419. #endif /* META */
  420.  
  421.  
  422. /*
  423. ******************************************************************************
  424. ** Program Constants.
  425. ******************************************************************************
  426. */
  427.  
  428. #ifndef FALSE
  429. #define FALSE 0
  430. #endif
  431. #ifndef TRUE
  432. #define TRUE  1
  433. #endif
  434. #define fFalse FALSE
  435. #define fTrue  TRUE
  436.  
  437. #define szAppNameCore "Astrolog"
  438. #define szVersionCore "5.10"
  439. #define szDateCore    "December 1995"
  440. #define szAddressCore "Astara@msn.com"
  441. #define szNowCore     "now"
  442. #define szTtyCore     "tty"
  443. #define szSetCore     "set"
  444. #define szNulCore     "nul"
  445.  
  446. #define cchSzDef   80
  447. #define cchSzMax   255
  448. #define nDegMax    360
  449. #define nDegHalf   180
  450. #define yeaJ2G     1582
  451. #define monJ2G     mOct
  452. #define dayJ2G1    4
  453. #define dayJ2G2    15
  454.  
  455. #define rPi        3.14159265358979323846
  456. #define rPi2       (rPi*2.0)
  457. #define rPiHalf    (rPi/2.0)
  458. #define rDegMax    360.0
  459. #define rDegHalf   180.0
  460. #define rDegQuad   90.0
  461. #define rDegRad    (rDegHalf/rPi)
  462. #define rEpoch2000 (-24.736467)
  463. #define rAxis      23.44578889
  464. #define rSmall     (1.7453E-09)
  465. #define rLarge     10000.0
  466. #define rRound     0.5
  467.  
  468. #define chNull     '\0'
  469. #define chEscape   '\33'
  470. #define chBell     '\7'
  471. #define chReturn   '\r'
  472. #define chTab      '\t'
  473. #define chDelete   '\b'
  474. #define chBreak    '\3'
  475. #define chRet      'R'
  476.  
  477. /* Array index limits */
  478.  
  479. #define cSign      12
  480. #define cObj       87
  481. #define cObjInt    uranHi
  482. #define objMax     (cObj+1)
  483. #define cAspect    18
  484. #define cAspectInt 11
  485. #define cSystem    14
  486. #define cCnstl     88
  487. #define cZone      69
  488. #define cPart      177
  489. #define cAspConfig 6
  490. #define cWeek      7
  491. #define cColor     16
  492. #define xFont      6
  493. #define yFont      10
  494. #define xFontT     (xFont*gi.nScaleT)
  495. #define yFontT     (yFont*gi.nScaleT)
  496. #define xSideT     (SIDESIZE*gi.nScaleT)
  497.  
  498. /* Object array index values */
  499.  
  500. #define cPlanet oVes
  501. #define cThing  oLil
  502. #define oMain   10
  503. #define oCore   20
  504. #define cUran   8
  505. #define cStar   47
  506. #define cuspLo  21
  507. #define cuspHi  32
  508. #define uranLo  33
  509. #define uranHi  40
  510. #define oNorm   uranHi
  511. #define starLo  41
  512. #define starHi  cObj
  513.  
  514. /* Month index values */
  515.  
  516. #define mJan 1
  517. #define mFeb 2
  518. #define mMar 3
  519. #define mApr 4
  520. #define mMay 5
  521. #define mJun 6
  522. #define mJul 7
  523. #define mAug 8
  524. #define mSep 9
  525. #define mOct 10
  526. #define mNov 11
  527. #define mDec 12
  528.  
  529. /* Elements */
  530.  
  531. #define eFir 0
  532. #define eEar 1
  533. #define eAir 2
  534. #define eWat 3
  535.  
  536. /* Zodiac signs */
  537.  
  538. #define sAri 1
  539. #define sTau 2
  540. #define sGem 3
  541. #define sCan 4
  542. #define sLeo 5
  543. #define sVir 6
  544. #define sLib 7
  545. #define sSco 8
  546. #define sSag 9
  547. #define sCap 10
  548. #define sAqu 11
  549. #define sPis 12
  550.  
  551. /* Objects */
  552.  
  553. #define oEar 0
  554. #define oSun 1
  555. #define oMoo 2
  556. #define oMer 3
  557. #define oVen 4
  558. #define oMar 5
  559. #define oJup 6
  560. #define oSat 7
  561. #define oUra 8
  562. #define oNep 9
  563. #define oPlu 10
  564. #define oChi 11
  565. #define oCer 12
  566. #define oVes 15
  567. #define oNod 16
  568. #define oLil 17
  569. #define oSou 17
  570. #define oFor 18
  571. #define oVtx 19
  572. #define oEP  20
  573. #define oAsc 21
  574. #define oNad 24
  575. #define oDes 27
  576. #define oMC  30
  577.  
  578. /* Aspects */
  579.  
  580. #define aDir -2
  581. #define aSig -1
  582. #define aCon 1
  583. #define aOpp 2
  584. #define aSqu 3
  585. #define aTri 4
  586. #define aSex 5
  587. #define aInc 6
  588. #define aSSx 7
  589. #define aSSq 8
  590. #define aSes 9
  591. #define aQui 10
  592. #define aBQn 11
  593.  
  594. /* Biorhythm cycle constants */
  595.  
  596. #define brPhy 23.0
  597. #define brEmo 28.0
  598. #define brInt 33.0
  599.  
  600. /* Relationship chart modes */
  601.  
  602. #define rcSynastry   1
  603. #define rcComposite  2
  604. #define rcMidpoint   3
  605. #define rcDifference 4
  606. #define rcBiorhythm  5
  607. #define rcDual      -1
  608. #define rcTransit   -2
  609. #define rcProgress  -3
  610.  
  611. /* Aspect configurations */
  612.  
  613. #define acS  1
  614. #define acGT 2
  615. #define acTS 3
  616. #define acY  4
  617. #define acGC 5
  618. #define acC  6
  619.  
  620. /* Graphics chart modes */
  621.  
  622. #define gWheel      1
  623. #define gHouse      2
  624. #define gGrid       3
  625. #define gHorizon    4
  626. #define gOrbit      5
  627. #define gAstroGraph 6
  628. #define gEphemeris  7
  629. #define gWorldMap   8
  630. #define gGlobe      9
  631. #define gPolar     10
  632. #define gBiorhythm 11
  633. #define gCalendar  12
  634. #define gDisposit  13
  635. #ifdef WIN
  636. #define gAspect    14
  637. #define gMidpoint  15
  638. #define gArabic    16
  639. #define gSign      17
  640. #define gObject    18
  641. #define gHelpAsp   19
  642. #define gConstel   20
  643. #define gPlanet    21
  644. #define gMeaning   22
  645. #define gSwitch    23
  646. #define gObscure   24
  647. #define gKeystroke 25
  648. #define gCredit    26
  649. #define gRising    27
  650. #define gTraTraHit 28
  651. #define gTraTraInf 29
  652. #define gTraNatHit 30
  653. #define gTraNatInf 31
  654. #endif
  655.  
  656. /* Colors */
  657.  
  658. #define kReverse -2
  659. #define kDefault -1
  660. #define kBlack   0
  661. #define kMaroon  1
  662. #define kDkGreen 2
  663. #define kOrange  3
  664. #define kDkBlue  4
  665. #define kPurple  5
  666. #define kDkCyan  6
  667. #define kLtGray  7
  668. #define kDkGray  8
  669. #define kRed     9
  670. #define kGreen   10
  671. #define kYellow  11
  672. #define kBlue    12
  673. #define kMagenta 13
  674. #define kCyan    14
  675. #define kWhite   15
  676. #define kNull    16
  677.  
  678. /* Arabic parts */
  679.  
  680. #define apFor 0
  681. #define apSpi 1
  682.  
  683. /* Draw text formatting flags */
  684.  
  685. #define dtCent   0x0
  686. #define dtLeft   0x1
  687. #define dtBottom 0x2
  688. #define dtErase  0x4
  689. #define dtScale  0x8
  690. #define dtTop    0x10
  691.  
  692. /* User string parse modes */
  693.  
  694. #define pmMon     1
  695. #define pmDay     2
  696. #define pmYea     3
  697. #define pmTim     4
  698. #define pmDst     5
  699. #define pmZon     6
  700. #define pmLon     7
  701. #define pmLat     8
  702. #define pmObject  9
  703. #define pmAspect 10
  704. #define pmSystem 11
  705. #define pmSign   12
  706. #define pmColor  13
  707.  
  708. /* PC mouse flags */
  709.  
  710. #define mfLeft   0x01
  711. #define mfRight  0x02
  712. #define mfMiddle 0x04
  713.  
  714. /* Termination codes */
  715.  
  716. #define tcError -1
  717. #define tcOK    0
  718. #define tcFatal 1
  719. #define tcForce 2
  720.  
  721. #ifndef _ZRES256COLOR
  722. #define _ZRES256COLOR 263
  723. #endif
  724.  
  725.  
  726. /*
  727. ******************************************************************************
  728. ** Macro Functions.
  729. ******************************************************************************
  730. */
  731.  
  732. #define BLo(w) ((byte)(w))
  733. #define BHi(w) ((byte)((word)(w) >> 8 & 0xFF))
  734. #define WLo(l) ((word)(dword)(l))
  735. #define WHi(l) ((word)((dword)(l) >> 16 & 0xFFFF))
  736. #define WFromBB(bLo, bHi) ((word)BLo(bLo) | (word)((byte)(bHi)) << 8)
  737. #define LFromWW(wLo, wHi) ((dword)WLo(wLo) | (dword)((word)(wHi)) << 16)
  738. #define LFromBB(b1, b2, b3, b4) LFromWW(WFromBB(b1, b2), WFromBB(b3, b4))
  739. #ifndef WIN
  740. #define RGB(bR, bG, bB) \
  741.   ((dword)((byte)(bR) | (word)(bG)<<8 | (dword)(byte)(bB)<<16))
  742. #endif
  743. #define RGBR(l) BLo(l)
  744. #define RGBG(l) BHi(l)
  745. #define RGBB(l) ((byte)((dword)(l) >> 16 & 0xFF))
  746. #define ChHex(n) (char)((n) < 10 ? '0' + (n) : 'a' + (n) - 10)
  747. #define VgaFromEga(x) NMultDiv((x), 480, 350)
  748. #define VgaFromCga(x) NMultDiv((x), 480, 200)
  749.  
  750. #define Max(v1, v2) ((v1) > (v2) ? (v1) : (v2))
  751. #define Min(v1, v2) ((v1) < (v2) ? (v1) : (v2))
  752. #define NSgn(n) ((n) < 0 ? -1 : (n) > 0 ? 1 : 0)
  753. #define RSgn2(r) ((r) < 0.0 ? -1.0 : 1.0)
  754. #define FBetween(v, v1, v2) ((v) >= (v1) && (v) <= (v2))
  755. #define RFract(r) ((r) - RFloor(r))
  756. #define ChCap(ch) ((ch) >= 'a' && (ch) <= 'z' ? (ch) - 'a' + 'A' : (ch))
  757. #define ChUncap(ch) (FCapCh(ch) ? (ch) - 'A' + 'a' : (ch))
  758. #define FCapCh(ch) ((ch) >= 'A' && (ch) <= 'Z')
  759. #define FNumCh(ch) ((ch) >= '0' && (ch) <= '9')
  760. #define NMultDiv(n1, n2, n3) ((int)((long)(n1) * (n2) / (n3)))
  761. #define Ratio(v1, v2, v3) ((v1) + ((v2) - (v1)) * (v3))
  762. #define ZFromS(s) ((real)(((s)-1)*30))
  763. #define SFromZ(r) (((int)(r))/30+1)
  764. #define RFromD(r) ((r)/rDegRad)
  765. #define DFromR(r) ((r)*rDegRad)
  766. #define RAbs(r) fabs(r)
  767. #define RFloor(r) floor(r)
  768. #define NFloor(r) ((int)RFloor(r))
  769. #define RSqr(r) sqrt(r)
  770. #define RSin(r) sin(r)
  771. #define RCos(r) cos(r)
  772. #ifndef PC
  773. #define RTan(r) tan(r)
  774. #else
  775. /* The tangent function in some PC compilers returns a result the negative */
  776. /* of what it should be when doing emulation for a non-math chip machine.  */
  777. #define RTan(r) (sin(r)/cos(r))
  778. #endif
  779. #define RAtn(r) atan(r)
  780. #define RAsin(r) asin(r)
  781. #define RAcos(r) acos(r)
  782. #define RSinD(r) RSin(RFromD(r))
  783. #define RCosD(r) RCos(RFromD(r))
  784. #define NSinD(nR, nD) ((int)((real)(nR)*RSinD((real)nD)))
  785. #define NCosD(nR, nD) ((int)((real)(nR)*RCosD((real)nD)))
  786.  
  787. #define FItem(obj)    FBetween(obj, 1, cObj)
  788. #define FNorm(obj)    FBetween(obj, 1, oNorm)
  789. #define FCusp(obj)    FBetween(obj, cuspLo, cuspHi)
  790. #define FAngle(obj)   (FCusp(obj) && (obj)%3 == 0)
  791. #define FMinor(obj)   (FCusp(obj) && (obj)%3 != 0)
  792. #define FUranian(obj) FBetween(obj, uranLo, uranHi)
  793. #define FStar(obj)    FBetween(obj, starLo, starHi)
  794. #define FObject(obj)  ((obj) <= oVes || (obj) >= uranLo)
  795. #define FThing(obj)   ((obj) <= cThing || (obj) >= uranLo)
  796. #define FHelio(obj)   (FNorm(obj) && FObject(obj) && (obj) != oMoo)
  797. #define FAspect(asp)  FBetween(asp, 1, us.nAsp)
  798. #define ChDst(dst)    (dst == 0.0 ? 'S' : (dst == 1.0 ? 'D' : 'A'))
  799. #define ChDashF(f)    (f ? '=' : '_')
  800. #define SzNumF(f)     (f ? "1 " : "0 ")
  801. #define DayInYearHi(yea) (365-28+DayInMonth(2, yea))
  802. #define FChSwitch(ch) \
  803.   ((ch) == '-' || (ch) == '/' || (ch) == '_' || (ch) == '=' || (ch) == ':')
  804.  
  805. #define FValidMon(mon) FBetween(mon, 1, 12)
  806. #define FValidDay(day, mon, yea) ((day) >= 1 && (day) <= DayInMonth(mon, yea))
  807. #define FValidYea(yea) FBetween(yea, -20000, 20000)
  808. #define FValidTim(tim) ((tim) > -2.0 && (tim) < 24.0)
  809. #define FValidDst(dst) FValidZon(dst)
  810. #define FValidZon(zon) FBetween(zon, -24.0, 24.0)
  811. #define FValidLon(lon) FBetween(lon, -rDegHalf, rDegHalf)
  812. #define FValidLat(lat) FBetween(lat, -rDegQuad, rDegQuad)
  813. #define FValidAspect(asp) FBetween(asp, 0, cAspect)
  814. #define FValidSystem(n) FBetween(n, 0, cSystem-1)
  815. #define FValidDivision(n) FBetween(n, 1, 2880)
  816. #define FValidOffset(r) FBetween(r, -rDegMax, rDegMax)
  817. #define FValidCenter(obj) \
  818.   (FBetween(obj, oEar, uranHi) && FObject(obj) && (obj) != oMoo)
  819. #define FValidHarmonic(n) FBetween(n, 1, 30000)
  820. #define FValidWheel(n) FBetween(n, 1, WHEELROWS)
  821. #define FValidAstrograph(n) (n > 0 && 160%n == 0)
  822. #define FValidPart(n) FBetween(n, 1, cPart)
  823. #define FValidScreen(n) FBetween(n, 20, 200)
  824. #define FValidMacro(n) FBetween(n, 1, 48)
  825. #define FValidTextrows(n) ((n) == 25 || (n) == 43 || (n) == 50)
  826. #define FValidGlyphs(n) FBetween(n, 0, 2223)
  827. #define FValidGrid(n) FBetween(n, 1, cObj)
  828. #define FValidScale(n) (FBetween(n, 100, MAXSCALE) && (n)%100 == 0)
  829. #define FValidGraphx(x) (FBetween(x, BITMAPX1, BITMAPX) || (x) == 0)
  830. #define FValidGraphy(y) (FBetween(y, BITMAPY1, BITMAPY) || (y) == 0)
  831. #define FValidRotation(n) FBetween(n, 0, nDegMax-1)
  832. #define FValidTilt(n) FBetween(n, -rDegQuad, rDegQuad)
  833. #define FValidColor(n) FBetween(n, 0, cColor - 1)
  834. #define FValidBmpmode(ch) \
  835.   ((ch) == 'N' || (ch) == 'C' || (ch) == 'V' || (ch) == 'A' || (ch) == 'B')
  836. #define FValidTimer(n) FBetween(n, 1, 32000)
  837.  
  838. #define chSig3(A) szSignName[A][0], szSignName[A][1], szSignName[A][2]
  839. #define chObj3(A) szObjName[A][0], szObjName[A][1], szObjName[A][2]
  840. #define chMon3(A) szMonth[A][0], szMonth[A][1], szMonth[A][2]
  841. #define chDay3(A) szDay[A][0], szDay[A][1], szDay[A][2]
  842. #define kSignA(s) kElemA[(s)-1 & 3]
  843. #define kSignB(s) kElemB[(s)-1 & 3]
  844. #define kModeA(m) kElemA[m <= 1 ? m : eWat]
  845. #define fSouthNode (!us.fPlacalc)
  846.  
  847. #define loop for (;;)
  848. #define not(V) V = !(V)
  849. #define neg(V) V = -(V)
  850. #define PrintL() PrintCh('\n')
  851. #define PrintL2() PrintSz("\n\n")
  852. #define PrintF(sz) fprintf(file, sz)
  853. #define PrintFSz() fprintf(file, sz)
  854. #define SwapN(n1, n2) (n1)^=(n2)^=(n1)^=(n2)
  855. #define SwitchF(f) f = (((f | fOr) & !fAnd) ^ fNot)
  856. #define SwitchF2(f) f = ((f | (fOr || fNot)) & !fAnd)
  857. #define SetCI(ci, M, D, Y, T, S, Z, O, A) \
  858.   ci.mon = M; ci.day = D; ci.yea = Y; \
  859.   ci.tim = T; ci.dst = S; ci.zon = Z; ci.lon = O; ci.lat = A
  860.  
  861. #ifndef PC
  862. #define chDirSep '/'
  863. #define chSwitch '-'
  864. #define CONST
  865. #define NPTR
  866. #define FPTR
  867. #define HPTR
  868. #define AllocateNear(p, cb) (p) = (void *)malloc(cb)
  869. #define AllocateFar(p, cb)  AllocateNear(p, cb)
  870. #define AllocateHuge(p, cb) AllocateFar(p, cb)
  871. #define DeallocateNear(p) free(p)
  872. #define DeallocateFar(p)  DeallocateNear(p)
  873. #define DeallocateHuge(p) DeallocateFar(p)
  874. #ifndef MAC
  875. #define ldTime 2440588L
  876. #else
  877. #define ldTime 2416481L
  878. #endif
  879. #define ARR
  880. #else /* PC */
  881. #define chDirSep '\\'
  882. #define chSwitch '/'
  883. #define CONST const
  884. #ifndef WIN
  885. #define NPTR near
  886. #define FPTR far
  887. #else
  888. #define NPTR
  889. #define FPTR
  890. #endif
  891. #define HPTR huge
  892. #define AllocateNear(p, cb) (p) = malloc(cb)
  893. #define AllocateFar(p, cb)  (p) = _fmalloc(cb)
  894. #define AllocateHuge(p, cb) (p) = halloc(cb, sizeof(byte))
  895. #define DeallocateNear(p) free(p)
  896. #define DeallocateFar(p)  _ffree(p)
  897. #define DeallocateHuge(p) hfree(p)
  898. #define ldTime 2440588L
  899. #ifndef __TURBOC__
  900. #define ARR
  901. #else
  902. #define ARR far
  903. #endif
  904. #endif /* PC */
  905.  
  906. #ifdef GRAPH
  907. #ifdef WIN
  908. #define API FAR PASCAL
  909. #define hdcNil ((HDC)NULL)
  910. #endif
  911. #ifdef MSG
  912. #define xPcScreen gi.cfg.numxpixels
  913. #define yPcScreen gi.cfg.numypixels
  914. #define FValidResmode(n) FBetween(n, _MAXRESMODE, _ZRES256COLOR)
  915. #define FEgaRes(res) (res == _ERESNOCOLOR || res == _ERESCOLOR)
  916. #define FCgaRes(res) (res == _HRESBW || res == _HRES16COLOR)
  917. #define PcMoveTo(x, y) _moveto(x, y)
  918. #define PcLineTo(x, y) _lineto(x, y)
  919. #define PcSetTextRows(n) _settextrows(gs.nTextRows)
  920. #endif
  921. #ifdef BGI
  922. #define xPcScreen (getmaxx()+1)
  923. #define yPcScreen (getmaxy()+1)
  924. #define FValidResmode(n) FBetween(n, -500, 500)
  925. #define FEgaRes(res) (yPcScreen == 350)
  926. #define FCgaRes(res) (yPcScreen == 200)
  927. #define PcMoveTo(x, y) moveto(x, y)
  928. #define PcLineTo(x, y) lineto(x, y)
  929. #define PcSetTextRows(n) if ((n) > 25) textmode(C4350)
  930. #endif
  931.  
  932. /* Should an object in the outer wheel be restricted? */
  933. #define FProper2(i) (!(us.nRel == rcTransit ? ignore2[i] : ignore[i]))
  934.  
  935. /* Are particular coordinates on the chart? */
  936. #define FInRect(x, y, x1, y1, x2, y2) \
  937.   ((x) >= (x1) && (x) < (x2) && (y) >= (y1) && (y) < (y2))
  938. #define FOnWin(X, Y) FInRect((X), (Y), 0, 0, gs.xWin, gs.yWin)
  939.  
  940. /* Get a coordinate based on chart radius, a fraction, and (co)sin value. */
  941. #define POINT1(U, R, S) ((int)(((U)+1.4)*(R)*(S)))
  942. #define POINT2(U, R, S) ((int)(((U)-0.3)*(R)*(S)))
  943.  
  944. /* Determine (co)sin factors based on zodiac angle and chart orientation. */
  945. #define PX(A) RCosD(A)
  946. #define PY(A) RSinD(A)
  947. #define PZ(A) Mod(rDegHalf-(A)+asc)
  948.  
  949. /* Compute Mollewide projection in pixel scale given latitude. */
  950. #define NMollewide(y) \
  951.   ((int)(RSqr((real)(180L*nScl*180L*nScl - 4L*(y)*nScl*(y)*nScl))+rRound))
  952.  
  953. /* Do settings indicate the current chart should have the info sidebar? */
  954. #define fSidebar \
  955.   ((gi.nMode == gWheel || gi.nMode == gHouse) && gs.fText && !us.fVelocity)
  956.  
  957. /* Is the current chart most properly displayed as a square graphic? */
  958. #define fSquare \
  959.   (gi.nMode == gWheel || gi.nMode == gHouse || gi.nMode == gGrid || \
  960.   (gi.nMode == gHorizon && us.fPrimeVert) || gi.nMode == gDisposit || \
  961.   gi.nMode == gOrbit || gi.nMode == gGlobe || gi.nMode == gPolar)
  962.  
  963. /* Does the current chart have to be displayed in a map rectangle? */
  964. #define fMap \
  965.   (gi.nMode == gAstroGraph || gi.nMode == gWorldMap)
  966.  
  967. /* Do settings indicate the current chart should have an outer border? */
  968. #define fDrawBorder \
  969.   ((gs.fBorder || gi.nMode == gGrid) && gi.nMode != gGlobe && \
  970.   gi.nMode != gPolar && (gi.nMode != gWorldMap || !gs.fMollewide))
  971.  
  972. /* Do settings indicate current chart should have chart info at its bottom? */
  973. #define fDrawText \
  974.   (gs.fText && gi.nMode != gCalendar && gi.nMode != gWorldMap && \
  975.   gi.nMode != gGlobe && gi.nMode != gPolar && \
  976.   ((gi.nMode != gWheel && gi.nMode != gHouse) || us.fVelocity))
  977. #endif /* GRAPH */
  978.  
  979.  
  980. /*
  981. ******************************************************************************
  982. ** Type Definitions.
  983. ******************************************************************************
  984. */
  985.  
  986. #define byte  unsigned char
  987. #define word  unsigned short
  988. #define dword unsigned long
  989. #define word4 long
  990. #define real  double
  991. #define _char unsigned char
  992. #define _int  unsigned int
  993. #define bool  int
  994. #define _bool char
  995. #define lpbyte byte FPTR *
  996. #define hpbyte byte HPTR *
  997. #define lpreal real FPTR *
  998.  
  999. typedef struct _GridInfo {
  1000.   byte  n[objMax][objMax];
  1001.   short v[objMax][objMax];
  1002. } GridInfo;
  1003.  
  1004. typedef struct _CrossInfo {
  1005.   real lat[MAXCROSS];
  1006.   real lon[MAXCROSS];
  1007.   int obj1[MAXCROSS];
  1008.   int obj2[MAXCROSS];
  1009. } CrossInfo;
  1010.  
  1011. #ifdef GRAPH
  1012. #define KV unsigned long
  1013. #define KI int
  1014. #endif /* GRAPH */
  1015.  
  1016. typedef struct _UserSettings {
  1017.  
  1018.   /* Chart types */
  1019.   _bool fListing;       /* -v */
  1020.   _bool fWheel;         /* -w */
  1021.   _bool fGrid;          /* -g */
  1022.   _bool fAspList;       /* -a */
  1023.   _bool fMidpoint;      /* -m */
  1024.   _bool fHorizon;       /* -Z */
  1025.   _bool fOrbit;         /* -S */
  1026.   _bool fInfluence;     /* -j */
  1027.   _bool fAstroGraph;    /* -L */
  1028.   _bool fCalendar;      /* -K */
  1029.   _bool fInDay;         /* -d */
  1030.   _bool fInDayInf;      /* -D */
  1031.   _bool fEphemeris;     /* -E */
  1032.   _bool fTransit;       /* -t */
  1033.   _bool fTransitInf;    /* -T */
  1034.  
  1035.   /* Chart suboptions */
  1036.   _bool fVelocity;      /* -v0 */
  1037.   _bool fWheelReverse;  /* -w0 */
  1038.   _bool fGridConfig;    /* -g0 */
  1039.   _bool fAppSep;        /* -ga */
  1040.   _bool fParallel;      /* -gp */
  1041.   _bool fAspSummary;    /* -a0 */
  1042.   _bool fMidSummary;    /* -m0 */
  1043.   _bool fMidAspect;     /* -ma */
  1044.   _bool fPrimeVert;     /* -Z0 */
  1045.   _bool fHorizonSearch; /* -Zd */
  1046.   _bool fInfluenceSign; /* -j0 */
  1047.   _bool fLatitudeCross; /* -L0 */
  1048.   _bool fCalendarYear;  /* -Ky */
  1049.   _bool fInDayMonth;    /* -dm */
  1050.   _bool fArabicFlip;    /* -P0 */
  1051.  
  1052.   /* Table chart types */
  1053.   _bool fCredit;        /* -Hc */
  1054.   _bool fSwitch;        /* -H  */
  1055.   _bool fSwitchRare;    /* -Y  */
  1056.   _bool fKeyGraph;      /* -HX */
  1057.   _bool fSign;          /* -HC */
  1058.   _bool fObject;        /* -HO */
  1059.   _bool fAspect;        /* -HA */
  1060.   _bool fConstel;       /* -HF */
  1061.   _bool fOrbitData;     /* -HS */
  1062.   _bool fMeaning;       /* -HI */
  1063.  
  1064.   /* Main flags */
  1065.   _bool fLoop;        /* -Q */
  1066.   _bool fSidereal;    /* -s */
  1067.   _bool fCusp;        /* -C */
  1068.   _bool fUranian;     /* -u */
  1069.   _bool fProgress;    /* Are we doing a -p progressed chart?           */
  1070.   _bool fInterpret;   /* Is -I interpretation switch in effect?        */
  1071.   _bool fFlip;        /* -f */
  1072.   _bool fDecan;       /* -3 */
  1073.   _bool fGeodetic;    /* -G */
  1074.   _bool fPlacalc;     /* -b */
  1075.   _bool fWriteFile;   /* -o */
  1076.   _bool fGraphics;    /* -X */
  1077.  
  1078.   /* Main subflags */
  1079.   _bool fNoSwitches;
  1080.   _bool fLoopInit;    /* -Q0 */
  1081.   _bool fSeconds;     /* -b0 */
  1082.   _bool fPlacalcAst;  /* -ba */
  1083.   _bool fEquator;     /* -sr */
  1084.   _bool fSolarArc;    /* -p0 */
  1085.   _bool fWritePos;    /* -o0 */
  1086.  
  1087.   /* Rare flags */
  1088.   _bool fTrueNode;    /* -Yn */
  1089.   _bool fEuroDate;    /* -Yd */
  1090.   _bool fEuroTime;    /* -Yt */
  1091.   _bool fSmartCusp;   /* -YC */
  1092.   _bool fClip80;      /* -Y8 */
  1093.   _bool fWriteOld;    /* -Yo */
  1094.   _bool fHouseAngle;  /* -Yc */
  1095.   _bool fNoWrite;     /* -0o */
  1096.   _bool fNoRead;      /* -0i */
  1097.   _bool fNoQuit;      /* -0q */
  1098.   _bool fNoGraphics;  /* -0X */
  1099.  
  1100.   /* Value settings */
  1101.   int   nEphemYears;  /* -Ey */
  1102.   int   nArabic;      /* -P */
  1103.   int   nRel;         /* What relationship chart are we doing, if any? */
  1104.   int   nHouseSystem; /* -c */
  1105.   int   nAsp;         /* -A */
  1106.   int   objCenter;    /* -h */
  1107.   int   nStar;        /* -U */
  1108.   int   nHarmonic;    /* Harmonic chart value passed to -x switch.     */
  1109.   int   objOnAsc;     /* House value passed to -1 or -2 switch.        */
  1110.   int   dayDelta;     /* -+, -- */
  1111.   int   nDegForm;     /* -s */
  1112.   int   nDivision;    /* -d */
  1113.   int   nScreenWidth; /* -I */
  1114.   int   fAnsi;        /* -k */
  1115.   real  dstDef;       /* -z0 */
  1116.   real  zonDef;       /* -z  */
  1117.   real  lonDef;       /* -l  */
  1118.   real  latDef;       /* -l  */
  1119.  
  1120.   /* Value subsettings */
  1121.   int   nWheelRows;      /* Number of rows per house to use for -w wheel. */
  1122.   int   nAstroGraphStep; /* Latitude step rate passed to -L switch.       */
  1123.   int   nArabicParts;    /* Arabic parts to include value passed to -P.   */
  1124.   real  rZodiacOffset;   /* Position shifting value passed to -s switch.  */
  1125.   real  rProgDay;        /* Progression day value passed to -pd switch.   */
  1126.   int   nRatio1;         /* Chart ratio factors passed to -rc or -rm.     */
  1127.   int   nRatio2;
  1128.   int   nScrollRow;      /* -YQ */
  1129.   long  lTimeAddition;   /* -Yz */
  1130.   int   nArabicNight;    /* -YP */
  1131. } US;
  1132.  
  1133. typedef struct _InternalSettings {
  1134.   _bool fHaveInfo;    /* Do we need to prompt user for chart info?         */
  1135.   _bool fProgress;    /* Are we doing a chart involving progression?       */
  1136.   _bool fMult;        /* Have we already printed at least one text chart?  */
  1137.   _bool fSeconds;     /* Do we print locations to nearest second?          */
  1138.   _bool fSzPersist;   /* Are parameter strings persistent when processing? */
  1139.   _bool fSzInteract;  /* Are we in middle of chart so some setting fixed?  */
  1140.   char *szProgName;   /* The name and path of the executable running.      */
  1141.   char *szFile;       /* The input chart filename string as passed to -i.  */
  1142.   char *szFile2;      /* The second chart filename string as passed to -r. */
  1143.   char *szFileScreen; /* The file to send text output to as passed to -os. */
  1144.   char *szFileOut;    /* The output chart filename string as passed to -o. */
  1145.   char **rgszComment; /* Points to any comment strings after -o filename.  */
  1146.   int cszComment;     /* The number of strings after -o that are comments. */
  1147.   int cchCol;         /* The current column text charts are printing at.   */
  1148.   int cchRow;         /* The current row text charts have scrolled to.     */
  1149.   real rSid;          /* Sidereal offset degrees to be added to locations. */
  1150.   real JD;            /* Fractional Julian day for current chart.          */
  1151.   real JDp;           /* Julian day that a progressed chart indicates.     */
  1152. } IS;
  1153.  
  1154. typedef struct _ChartInfo {
  1155.   int mon;   /* Month            */
  1156.   int day;   /* Day              */
  1157.   int yea;   /* Year             */
  1158.   real tim;  /* Time in hours    */
  1159.   real dst;  /* Daylight offset  */
  1160.   real zon;  /* Time zone        */
  1161.   real lon;  /* Longitude        */
  1162.   real lat;  /* Latitude         */
  1163.   char *nam; /* Name for chart   */
  1164.   char *loc; /* Name of location */
  1165. } CI;
  1166.  
  1167. typedef struct _ChartPositions {
  1168.   real obj[objMax];   /* The zodiac positions.    */
  1169.   real alt[objMax];   /* Ecliptic declination.    */
  1170.   real dir[objMax];   /* Retrogradation velocity. */
  1171.   real cusp[cSign+1]; /* House cusp positions.    */
  1172.   byte house[objMax]; /* House each object is in. */
  1173. } CP;
  1174.  
  1175. #ifdef GRAPH
  1176. typedef struct _GraphicsSettings {
  1177.   _bool fBitmap;    /* Are we creating a bitmap file (-Xb set).         */
  1178.   _bool fPS;        /* Are we generating a PostScript file (-Xp set).   */
  1179.   _bool fMeta;      /* Are we generating a metafile graphic (-XM set).  */
  1180.   _bool fColor;     /* Are we drawing a color chart (-Xm not set).      */
  1181.   _bool fInverse;   /* Are we drawing in reverse video (-Xr set).       */
  1182.   _bool fRoot;      /* Are we drawing on the X11 background (-XB set).  */
  1183.   _bool fText;      /* Are we printing chart info on chart (-XT set).   */
  1184.   _bool fFont;      /* Are we simulating fonts in charts (-XM0 set).    */
  1185.   _bool fAlt;       /* Are we drawing in alternate mode (-Xi set).      */
  1186.   _bool fBorder;    /* Are we drawing borders around charts (-Xu set).  */
  1187.   _bool fLabel;     /* Are we labeling objects in charts (-Xl not set). */
  1188.   _bool fJetTrail;  /* Are we not clearing screen on updates (-Xj set). */
  1189.   _bool fMouse;     /* Are we not considering PC mouse inputs.          */
  1190.   _bool fConstel;   /* Are we drawing maps as constellations (-XF set). */
  1191.   _bool fMollewide; /* Are we drawing maps scaled correctly (-XW0 set). */
  1192.   _bool fPrintMap;  /* Are we printing globe names on draw (-XP0 set).  */
  1193.   int xWin;         /* Current size of graphic chart (-Xw).      */
  1194.   int yWin;
  1195.   int nAnim;        /* Current animation mode, if any (-Xn).     */
  1196.   int nScale;       /* Current character scale factor (-Xs).     */
  1197.   int objLeft;      /* Current object to place on Asc (-X1).     */
  1198.   int nTextRows;    /* Numb. of rows to set text screen to (-V). */
  1199.   int nRot;         /* Current rotation degree of globe.         */
  1200.   real rTilt;       /* Current vertical tilt of rotating globe.  */
  1201.   char chBmpMode;   /* Current bitmap file type (-Xb).           */
  1202.   int nOrient;      /* PostScript paper orientation indicator.   */
  1203.   real xInch;       /* PostScript horizontal paper size inches.  */
  1204.   real yInch;       /* PostScript vertical paper size inches.    */
  1205.   char *szDisplay;  /* Current X11 display name (-Xd).           */
  1206.   int nGridCell;    /* Number of cells in -g grids (-Yg).        */
  1207.   int nGlyphs;      /* Settings for what gylphs to use (-YG).    */
  1208. #ifdef PCG
  1209.   int nResHi;       /* 'High-resolution' graphics mode. */
  1210.   int nResLo;       /* 'Flicker-free' graphics mode.    */
  1211. #endif
  1212. } GS;
  1213.  
  1214. typedef struct _GraphicsInternal {
  1215.   int nMode;            /* Current type of chart to create.           */
  1216.   _bool fMono;          /* Is this a monochrome monitor.              */
  1217.   int kiCur;            /* Current color drawing with.                */
  1218.   hpbyte bm;            /* Pointer to allocated memory.               */
  1219.   int cbBmpRow;         /* Horizontal size of bitmap array in memory. */
  1220.   char *szFileOut;      /* Current name of bitmap file (-Xo).         */
  1221.   FILE *file;           /* Actual file handle writing graphics to.    */
  1222.   int yBand;            /* Vertical offset to current bitmap band.    */
  1223.   _bool fFile;          /* Are we making a graphics file.             */
  1224.   int nScale;           /* Scale ratio, i.e. percentage / 100.        */
  1225.   int nScaleT;          /* Relative scale to draw chart text at.      */
  1226.   int nPenWid;          /* Pen width to use when creating metafiles.  */
  1227.   KI kiOn;              /* Foreground color. */
  1228.   KI kiOff;             /* Background color. */
  1229.   KI kiLite;            /* Hilight color.    */
  1230.   KI kiGray;            /* A "dim" color.    */
  1231.   int xOffset;          /* Viewport origin.                           */
  1232.   int yOffset;
  1233.   int xTurtle;          /* Current coordinates of drawing pen.        */
  1234.   int yTurtle;
  1235.   int xPen;             /* Cached coordinates where last line ended.  */
  1236.   int yPen;
  1237. #ifdef X11
  1238.   Display *disp;        /* The opened X11 display (-Xd). */
  1239.   GC gc, pmgc;
  1240.   Pixmap pmap, icon;
  1241.   Window wind, root;
  1242.   int screen;
  1243.   int depth;            /* Number of active color bits.  */
  1244. #endif
  1245. #ifdef PS               /* Variables used by the PostScript generator. */
  1246.   _bool fEps;           /* Are we doing Encapsulated PostScript.    */
  1247.   int cStroke;          /* Number of items drawn without fluahing.  */
  1248.   _bool fLineCap;       /* Are line ends rounded instead of square. */
  1249.   int nDash;            /* How much long are dashes in lines drawn. */
  1250.   int nFont;            /* What system font are we drawing text in. */
  1251.   real rLineWid;        /* How wide are lines, et al, drawn with.   */
  1252. #endif
  1253. #ifdef META             /* Variables used by the metafile generator.  */
  1254.   word HPTR *pwMetaCur; /* Current mem position when making metafile. */
  1255.   word HPTR *pwPoly;    /* Position for start of current polyline.    */
  1256.   long cbMeta;
  1257.   KI kiLineAct;         /* Desired and actual line color. */
  1258.   KI kiLineDes;
  1259.   KI kiFillAct;         /* Desired and actual fill color. */
  1260.   KI kiFillDes;
  1261.   int nFontAct;         /* Desired and actual text font.  */
  1262.   int nFontDes;
  1263.   KI kiTextAct;         /* Desired and actual text color. */
  1264.   KI kiTextDes;
  1265.   int nAlignAct;        /* Desired/actual text alignment. */
  1266.   int nAlignDes;
  1267. #endif
  1268. #ifdef MSG              /* MS graphics PC specific global variables.  */
  1269.   int nRes;             /* Current graphics mode.                     */
  1270.   struct videoconfig cfg;          /* State of current graphics mode. */
  1271. #endif
  1272. #ifdef BGI              /* Borland BGI PC specific global variables.  */
  1273.   int nRes;             /* Current graphics mode.              */
  1274.   _bool fLoaded;        /* Have we loaded the graphics driver. */
  1275.   int nDriver;          /* Current graphics driver.            */
  1276.   int nGraph;           /* Current mode within driver.         */
  1277.   int nPages;           /* Number of pages in current mode.    */
  1278.   int nPageCur;         /* The current page bring drawn in.    */
  1279. #endif
  1280. } GI;
  1281. #endif /* GRAPH */
  1282.  
  1283. typedef struct _ArabicInfo {
  1284.   char *form;                 /* The formula to calculate it. */
  1285.   char *name;                 /* The name of the Arabic part. */
  1286. } AI;
  1287.  
  1288. typedef struct _ElementTable {
  1289.   int coSum;            /* Total objects considered.          */
  1290.   int coHemi;           /* Number that can be in hemispheres. */
  1291.   int coSign[cSign];    /* Number of objects in each sign.    */
  1292.   int coHouse[cSign];   /* Number of objects in each house.   */
  1293.   int coElemMode[4][3]; /* Objects in each elem/mode combo.   */
  1294.   int coElem[4];        /* Object in each element.            */
  1295.   int coMode[3];        /* Objects in each sign mode.         */
  1296.   int coModeH[3];       /* Objects in each house mode.        */
  1297.   int coYang;           /* Objects in Fire/Air signs.         */
  1298.   int coYin;            /* Objects in Earth/Water signs.      */
  1299.   int coLearn;          /* Objects in first six signs.        */
  1300.   int coShare;          /* Objects in last six signs.         */
  1301.   int coAsc;            /* Objects in Eastern houses.         */
  1302.   int coDes;            /* Objects in Western houses.         */
  1303.   int coMC;             /* Objects in Southern houses.        */
  1304.   int coIC;             /* Objects in Northern houses.        */
  1305. } ET;
  1306.  
  1307. typedef struct _OrbitalElements {
  1308.   real ma0, ma1, ma2; /* Mean anomaly.           */
  1309.   real ec0, ec1, ec2; /* Eccentricity.           */
  1310.   real sma;           /* Semi-major axis.        */
  1311.   real ap0, ap1, ap2; /* Argument of perihelion. */
  1312.   real an0, an1, an2; /* Ascending node.         */
  1313.   real in0, in1, in2; /* Inclination.            */
  1314. } OE;
  1315.  
  1316. #ifdef WIN
  1317. #define nScrollDiv 12
  1318. #define nScrollPage 3
  1319. #define cchSzMaxFile 128
  1320. #define szFileTempCore "ASTROLOG.TMP"
  1321.  
  1322. typedef struct _WindowInternal {
  1323.   HWND hinst;     /* Instance of the Astrolog window class.    */
  1324.   HWND hwndMain;  /* The outer created frame window.           */
  1325.   HWND hwnd;      /* The current window being dealt with.      */
  1326.   HMENU hmenu;    /* The Astrolog main menu bar.               */
  1327.   HACCEL haccel;  /* Keyboard accelerator or shortcut table.   */
  1328.   HDC hdc;        /* The current DC bring drawn upon.          */
  1329.   HDC hdcPrint;   /* The current DC being printed upon.        */
  1330.   HWND hwndAbort; /* Window of the printing abort dialog.      */
  1331.   HPEN hpen;      /* Pen with the current line color.          */
  1332.   HBRUSH hbrush;  /* Fill if any with the current color.       */
  1333.   HFONT hfont;    /* Font of current text size being printed.  */
  1334.   UINT nTimer;    /* Identifier for the animation timer.       */
  1335.   short xScroll;  /* Horizontal & vertical scrollbar position. */
  1336.   short yScroll;
  1337.   short xClient;  /* Horizontal & vertical window size. */
  1338.   short yClient;
  1339.   int xChar;      /* Horizontal & vertical font character size. */
  1340.   int yChar;
  1341.   int xMouse;     /* Horitontal & vertical mouse position. */
  1342.   int yMouse;
  1343.   WORD wCmd;      /* The currently invoked menu command.        */
  1344.   int nMode;      /* New chart type to switch to if any.        */
  1345.   bool fMenu;     /* Do we need to repaint the menu bar?        */
  1346.   bool fMenuAll;  /* Do we need to redetermine all menu checks? */
  1347.   bool fRedraw;   /* Do we need to redraw the screen?           */
  1348.   bool fCast;     /* Do we need to recast the chart positions?  */
  1349.   bool fAbort;    /* Did the user cancel printing in progress?  */
  1350.  
  1351.   /* Window User settings. */
  1352.   bool fPause;       /* Is animation paused?                   */
  1353.   bool fBuffer;      /* Are we drawing updates off screen?     */
  1354.   bool fHourglass;   /* Bring up hourglass cursor on redraws?  */
  1355.   bool fChartWindow; /* Does chart change cause window resize? */
  1356.   bool fWindowChart; /* Does window resize cause chart change? */
  1357.   KI kiPen;          /* The current pen scribble color.        */
  1358.   int nDir;          /* Animation step factor and direction.   */
  1359.   UINT nTimerDelay;  /* Milliseconds between animation draws.  */
  1360. } WI;
  1361. #endif
  1362.  
  1363. #include "extern.h"
  1364.  
  1365. /* astrolog.h */
  1366.